﻿using Demo.Models.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Demo.Controllers
{
    public class DrowdowlistController : Controller
    {
        //
        // GET: /Drowdowlist/
        Model1 db = new Model1();
        public ActionResult Index()
        {
         
            ViewBag.ListCate = new SelectList(db.Categories, "Id", "Name");
            return View();
        }
        [AcceptVerbs(HttpVerbs.Get)]
        public JsonResult GetByproduct(long idproduct)
        {
            var lstproduct = db.Products
                               .Where(x => x.Catid == idproduct).ToList();
                                 ;
                                 return Json(new { foo = lstproduct }, JsonRequestBehavior.AllowGet);
        }
	}
}